<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="user/header.html"}>
	<title>学员中心-德安信会计在线教育平台</title>
</head>
<body>
	<div class="wrap">
		<!--star left-->
		<div class="column">
			<{include file="user/left_menu.html"}>
		</div>
		<div id="ContMianBox">
			<!--star子栏目-->
			<div class="sub-colum">
				<div class="tit">班级管理</div>
				<ul>
					<li class="curr"><a href="/user/classes">我的班级</a></li>
					<li><a href="/user/class_time">我的课程表</a></li>
					<li><a href="/user/classes/volume_list/3">我的作业</a></li>
					<li><a href="/user/classes/volume_list/4">我的考试</a></li>
				</ul>
			</div>
			<!--end子栏目-->
			<!--end left-->
			<div class="container narrow">
				<!--star conter-->
				<div class="cetContent">
					<div class="tit p-lr20">
						<span class="curr"><{$action}></span>
					</div>
					<!--star内容区域-->
					<div class="mainScroll">
						<div class="mainContainer line-all">
							<!--star tabMainCont-->
							<fieldset class="layui-elem-field">
									<legend>筛选</legend>
									<div class="layui-field-box">
										<form class="layui-form layui-form-pane1" action="/user/classes/index" method="post">
											<div class="layui-form-item">
												<div class="layui-inline">
													<div class="layui-input-inline" style="width: 200px;">
														<input type="text" name="class_name" placeholder="班级名称" autocomplete="off" class="layui-input" value="<{if !empty($conditions['class_name'])}><{$conditions['class_name']}><{/if}>">
													</div>
												</div>
												<div class="layui-inline">
													<div class="layui-input-inline" style="width: 200px;">
														<input type="text" name="course_name" placeholder="课程名称" autocomplete="off" class="layui-input" value="<{if !empty($conditions['course_name'])}><{$conditions['course_name']}><{/if}>">
													</div>
												</div>
												<div class="layui-inline">
													<div class="layui-input-inline" style="width: 200px;">
														<input type="text" name="teacher_name" placeholder="老师名字" autocomplete="off" class="layui-input" value="<{if !empty($conditions['teacher_name'])}><{$conditions['teacher_name']}><{/if}>">
													</div>
												</div>

											</div>
											<div class="layui-form-item">
												<div class="layui-inline">
													<div class="layui-input-inline" style="width: 200px;">
														<input type="text" name="plan_time" placeholder="开课时间" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this, format: 'YYYY-MM-DD'})" value="<{if !empty($conditions['plan_time'])}><{$conditions['plan_time']|date_format: '%Y-%m-%d'}><{/if}>">
													</div>
												</div>
												<div class="layui-inline">
													<button type="submit" class="layui-btn">搜索</button>
													<a href="/user/classes/join_class" class="layui-btn">加入班级</a>
												</div>
											</div>
										</form>
									</div>
								</fieldset>
							<!--商品列表 star-->
							<div class="goods_list p-t10">
									<div class="mtc_tab">
										<!--star mt-->
										<div class="mt">
											<span class="l fs16">状态：</span>
											<a href="/user/classes/index/0/<{$conditions['class_name']}>/<{$conditions['course_name']}>/<{$conditions['teacher_name']}>/<{$conditions['plan_time']}>" <{if $conditions.status == 0}>class="curr"<{/if}>>全部</a>
											<a href="/user/classes/index/1/<{$conditions['class_name']}>/<{$conditions['course_name']}>/<{$conditions['teacher_name']}>/<{$conditions['plan_time']}>" <{if $conditions.status == 1}>class="curr"<{/if}>>上课中</a>
											<a href="/user/classes/index/2/<{$conditions['class_name']}>/<{$conditions['course_name']}>/<{$conditions['teacher_name']}>/<{$conditions['plan_time']}>" <{if $conditions.status == 2}>class="curr"<{/if}>>已结业</a>
										</div>
										<!--end mt-->
										<!--star mc-->
										<div class="mc">

											<div class="u_table_list m-t20">
												<!--star 商品-->
												<div class="table002">
													<table>
														<colgroup>
															<col width="%">
															<col width="%">
															<col width="%">
															<col width="%">
															<col width="%">
															<col width="%">
															<col width="%">
														</colgroup>
														<tbody>
															<tr>
																<th>班级名称</th>
																<th>课程</th>
																<th>主讲老师</th>
																<th>
																	校区
																</th>
																<th>开课时间</th>
																<th>课程表</th>
																<th>操作</th>
															</tr>
														</tbody>
														<tbody>
															<{foreach from=$class_list item=item}>
																<tr>

																	<td class="not_lb tal">
																		<span class="c-057edb">
																			<a href="/user/classes/detail/<{$item['id']}>"><{$item['class_name']}></a>
																		</span>
																	</td>
																	<td class="not_lb tal">
																		<span ><{$item['course_name']}></span>
																	</td>
																	<td class="not_lb tal">
																		<span class=""><{$item['lecturer_name']}></span>
																		<div class="colorBtn">
																		<p><a teacher_id="<{$item['lecturer_id']}>" class_id="<{$item['id']}>" class="score" href="javascript:void(0);">给老师打分</a></p>
																		</div>
																	</td>
																	<td class="not_lb tal">
																		<span ><{$item['school_name']}></span>
																	</td>
																	<td class="not_lb tal">
																		<{$item[ 'start_time']|date_format: '%Y-%m-%d'}>
																	</td>
																	<td class="not_lb tal">
																		<div class="colorBtn">
																			<p><a href="/user/classes/plan/<{$item['id']}>">课程表</a></p>
																		</div>
																	</td>
																	<td class="not_lb tal">
																		<div class="colorBtn">
																			<p><a href="/user/classes/detail/<{$item['id']}>">班级详情</a></p>
																			<p><a href="/user/classes/courseware/<{$item['id']}>">查看课件</a></p>
																		</div>
																	</td>
																</tr>
																<{/foreach}>
														</tbody>
													</table>
												</div>
												<!--end 商品-->
											</div>
											<div class="pages p-tb20" style="text-align:right;">
												<{$pagination}>
											</div>
										</div>
										<!--end mc-->
									</div>

								</div>
							<!--商品列表 end -->
						</div>
						<!--end tabMainCont-->
					</div>
				</div>
			</div>
			<!--end内容区域-->

		</div>
		<div id="score_box" style="padding: 10px; display: none;">
			<div class="layui-form-item">
	            <div class="layui-inline">
					<input type="text" id="score" value="<{if !empty($conditions.name)}><{$conditions.name}><{/if}>" placeholder="分数" autocomplete="off" class="layui-input">
				</div>

	            <div class="layui-inline">
					<textarea placeholder="评语" id="content" style="width: 340px;" class="layui-textarea"><{if isset($learn_what)}><{$learn_what}><{/if}></textarea>
				</div>
	        </div>
	        <div class="layui-form-item">
	        	<div class="layui-inline">
					<button type="submit" id="sub_score" class="layui-btn">确定</button>
				</div>
	        </div>
		</div>
		<script>

		$(".score").click(function(){
            var _this = $(this);
            var teacher_id = $(this).attr("teacher_id");
            var class_id = $(this).attr("class_id");
            var index = layer.open({
		  		type: 1,
		  		resize: false,
			  	content: $('#score_box') //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
			});
			// $("#score").val($(this).prev("span").html())

			$("#sub_score").click(function(){
				var score = $("#score").val();
				var content = $("#content").val();
				if(isNaN(score)){
	                layer.msg("必须是数字！", {icon:5, anim: 6});
	                return false;
	            }
	            if(score <= 0 || score > 100){
	            	layer.msg("评分必须大于1小于100", {icon:5, anim: 6});
	                return false;
	            }
				$.ajax({
                    type: "POST",
                    url: "/user/classes/update_score",
                    dataType:"json",
                    data:{'class_id':class_id, 'teacher_id':teacher_id, 'score':score, 'content':content},
                    success: function(result){
                        // layer.close(ii);
                        if(result.error == 0){
                        	layer.close(index)
                            layer.msg(result.msg, {icon:6});
                            _this.text(result.msg);
                            _this.prev("span").html(score);
                            // _this.unbind("click");
                        }else{
                            layer.msg(result.msg, {icon:5});
                        }
                    }
                });
			})
        })
	</script>
		<script>
			layui.use('laydate', function(){
			  var laydate = layui.laydate;

			  var start = {
			    min: '2016-11-31 23:59:59'
			    ,max: laydate.now(+1)
			    ,istoday: false
			    ,choose: function(datas){
			      end.min = datas; //开始日选好后，重置结束日的最小日期
			      end.start = datas //将结束日的初始值设定为开始日
			    }
			  };

			  var end = {
			    min: '2016-11-31 23:59:59'
			    ,max: laydate.now(+1)
			    ,istoday: false
			    ,choose: function(datas){
			      start.max = datas; //结束日选好后，重置开始日的最大日期
			    }
			  };

			  document.getElementById('LAY_demorange_s').onclick = function(){
			    start.elem = this;
			    laydate(start);
			  }
			  document.getElementById('LAY_demorange_e').onclick = function(){
			    end.elem = this
			    laydate(end);
			  }

			});
		</script>
	</div>
</body>
</html>
